﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
//using DCTM = Landscape.Business.Interface.Documentum;
using System.IO;

namespace Landscape.WebApp
{
    public partial class FileDownloader : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["DocID"] != null && Request.QueryString["DocID"].Trim() != string.Empty)
            {
                //var token = DCTM.SessionManager.GetManager().CreateDCTMAdminSession();
                //var fileLocation = DCTM.Actions.DownloadFile(Request.QueryString["DocID"].Trim(), Server.MapPath("~/TempFiles"), token);

                //DCTM.SessionManager.GetManager().ReleaseToken(ref token);

                //FileInfo file = new FileInfo(fileLocation);

                //Response.Clear();
                //Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
                //Response.AddHeader("Content-Length", file.Length.ToString());
                //Response.ContentType = "application/octet-stream";
                //Response.WriteFile(file.FullName);
                //Response.End();
            }
        }
    }
}